<?php

/**
 * comment模型类
 */
class commentModel extends model {//所有的模型类都继承基础模型的model

    /**
     * 留言列表
     */
    public function getAll($limit) {
        //拼接SQL
        $sql = "select id,poster,comment,date,reply,mail,ip from comment order by id desc limit $limit";
        $data = $this->db->fetchAll($sql);
        return $data;
    }

    /**
     * 留言总数
     */
    public function getNumber() {
        $data = $this->db->fetchRow("select count(*) from comment");
        return $data['count(*)'];
    }

}
